import request from '@/utils/request'


export function getuptoken() {
  return request({
    url: 'api/qiniu/uptoken',
    method: 'post'
  })
}



// 获取所有Meat列表
export function getMeatList(date, businessType, perPage, page) {
  const data = {
    date, businessType, perPage, page
  }
  return request({
    url: 'api/v1/backend/purchase/businessList',
    method: 'post',
    data
  })
}

// 获取填报详情
export function getMeatDetail(date, businessId, type) {
  const data = {
    date, businessId, type
  }
  return request({
    url: 'api/v1/backend/purchase/getPurchaseDetail',
    method: 'post',
    data
  })
}

// 获取需要手动填报的经营品类
export function getBusinessTypes() {
  return request({
    url: 'api/v1/backend/purchase/businessTypes',
    method: 'post'
  })
}

// 获取获取已/未填报数量
export function getPurchaseCountInfo(date) {
  const data = {
    date
  }
  return request({
    url: 'api/v1/backend/purchase/countInfo',
    method: 'post',
    data
  })
}

// 查询指定商户购进状态
export function getPurchaseStatus(businessId) {
  const data = {
    businessId
  }
  return request({
    url: 'api/v1/backend/purchase/getPurchaseStatus',
    method: 'post',
    data
  })
}

// 获取购进日期
export function getChooseDate() {
  return request({
    url: 'api/v1/backend/purchase/date',
    method: 'post'
  })
}

// 获取在售商品列表
export function getProductList(businessId,typeId) {
  const data = {
    businessId,typeId
  }
  return request({
    url: 'api/v1/backend/purchase/product_list',
    method: 'post',
    data
  })
}

// 肉类填报
export function meatSubmit(
  date,
  businessId,
  businessName,
  meatCheckCertificateNumber,
  animalProductCheckCertificateNumber,
  transactionNumber,
  redTicket,
  whiteTicket,
  typeId,
  purchaseChannels,
  products
){
  const data = {
    date,
    businessId,
    businessName,
    meatCheckCertificateNumber,
    animalProductCheckCertificateNumber,
    transactionNumber,
    redTicket,
    whiteTicket,
    typeId,
    purchaseChannels,
    products
  }
  return request({
    url: 'api/v1/backend/purchase/addPurchase',
    method: 'post',
    data
  })
}
